/**
 * Copyright (c) 2017-2024 Nop Platform. All rights reserved.
 * Author: canonical_entropy@163.com
 * Blog:   https://www.zhihu.com/people/canonical-entropy
 * Gitee:  https://gitee.com/canonical-entropy/nop-entropy
 * Github: https://github.com/entropy-cloud/nop-entropy
 */
package com.gitee.wsl.func.visit

abstract class AbstractVisitor<T> : IVisitor<T> {
    protected fun visitChildren(children: Collection<T>) {
        if (children.isNotEmpty()) {
            for (child in children) {
                visitChild(child)
            }
        }
    }

    protected fun visitChild(child: T) {
        if (child != null) visit(child)
    }
}
